package xyz.xtt.admin.constants;

import java.util.Arrays;
import java.util.Objects;

/**
 * 地皮类型
 * 
 * 上游业务 0是未知 1是普通 2是商业 3是地标
 * 
 * @author huqibo
 *
 */
public enum GroundTypeEnum {
	NORMAL(AssetTypeEnum.LAND, 0, "普通"), COMMERCIAL(AssetTypeEnum.LAND, 1, "商业"), LANDMARK(AssetTypeEnum.LAND, 2, "地标"),;

	private AssetTypeEnum assetTypeEnum;
	private int code;
	private String desc;

	private GroundTypeEnum(AssetTypeEnum assetTypeEnum, int code, String desc) {
		this.assetTypeEnum = assetTypeEnum;
		this.code = code;
		this.desc = desc;
	}

	public int code() {
		return code;
	}

	public String desc() {
		return desc;
	}

	public AssetTypeEnum assetType() {
		return assetTypeEnum;
	}

	public static GroundTypeEnum convert(String checkType) {
		return Arrays.asList(GroundTypeEnum.values()).stream().filter(x -> Objects.equals(x.name(), checkType)).findFirst().orElse(null);
	}

	public static GroundTypeEnum queryConvert(Integer checkType) {
		return Arrays.asList(GroundTypeEnum.values()).stream().filter(x -> Objects.equals(x.code(), checkType)).findFirst().orElse(null);
	}
}
